#!/bin/bash
# author: leman
# date: 2020.2.25

yum install gcc gcc-c++ cmake -y

yum -y install pcre-devel openssl openssl-devel zlib zlib-devel

mkdir -p /server/source
cd  /server/source

##get nginx 
wget http://nginx.org/download/nginx-1.8.1.tar.gz

tar -xvzf nginx-1.8.1.tar.gz

cd nginx-1.8.1

./configure --prefix=/usr/local/nginx-1.8.1 --with-http_stub_status_module --with-http_ssl_module

make && make install

/usr/local/ nginx-1.8.1/sbin/nginx
ln -s /usr/local/nginx-1.8.1/ /usr/local/nginx
echo "/usr/local/nginx/sbin/nginx" >/etc/rc.local

touch /etc/profile.d/nginx.sh
echo "export PATH=/usr/local/nginx/sbin:$PATH" >/etc/profile.d/nginx.sh
source /etc/profile.d/nginx.sh

##check
curl  http://127.0.0.1